local rule = fk.CreateSkill {
  name = "#hx__simulator_rule&",
}

local U = require "packages/utility/utility"
local HX = require "packages/huixiangkill/hxfs"

--添加第二副扑克
rule:addEffect(fk.GameStart, {
  priority = 0.001,
  can_refresh = function(self, event, target, player, data)
    return player.seat == 1
  end,
  on_refresh = function(self, event, target, player, data)
    local room = player.room
    local allCardIds = Fk:getAllCardIds()
    local allcards = {}
    local white_cards = {"huixiang__poker"}
    for j = 1, 1 do
      for i = #allCardIds, 1, -1 do
        local id = allCardIds[i]
        local card = Fk:getCardById(id)
        if card then
          if table.contains(white_cards, card.package.name) then
            if not card.is_derived then
              table.insert(allcards, {card.name, card.suit, card.number})
            end
          end
        end
      end
    end
    room:changeCardArea(U.prepareDeriveCards(room, allcards, self.name), Card.DrawPile)
    if #room.draw_pile < 108 then
      room:sendLog{ type = "未开启<b>扑克牌</b>卡组，无法开始游戏！", toast = true }
      room:delay(2000)
      room:gameOver("")
    end
  end,
})



return rule
